package com.yl.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yl.exception.CustomException;
import com.yl.mapper.RoleMenuMapper;
import com.yl.model.entity.RoleMenuEntity;
import com.yl.service.RoleMenuService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenuEntity> implements RoleMenuService {

    @Resource
    private RoleMenuMapper roleMenuMapper;

    @Override
    public Boolean removeRole(Long roleId) {
        int del = roleMenuMapper.removeRole(roleId);
        if(del==0) throw new CustomException("删除角色失败");
        return true;
    }
}
